home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-03-19 | 55.0 KB | 1,377 lines | [TEXT/MPS ] |
- #
- # ****************************************************************************
- #
- # File Name: TCS.Lib
- #
- # Contains: Library used for tracking and logging Test Case completion and success/failure.
- #
- # Written by: KTA, KL, ML, GS et al
- #
- # Copyright: © 1993-1996 by Apple Computer, Inc., all rights reserved.
- #
- # ****************************************************************************
- # C h a n g e H i s t o r y (most recent first):
- # ****************************************************************************
- #
- # Vers Date Author Description
- # ---- -------- ------ ---------------------------------------------
- # .111111> 6/18/96 MDF Added support to SuiteEnd() for tracking the number of failed
- # test cases.
- # .111110> 6/18/96 MDF Added global gIsBothMethods to correctly handle both
- # test case logging methods.
- # .11119+> 6/18/96 MDF Added global gIsBothMethods to correctly handle both test case
- # logging methods.
- # 2.11119> 6/17/96 MDF Modified SuiteEnd() to check for single digit day.
- # .11118+> 6/17/96 MDF Modified SuiteEnd() to check for single digit day.
- # 2.11118> 3/11/96 JC Modified to call BuildSuiteFields regardless if Results
- # Express global to set to false and if TRACS global is
- # set to true.
- # .11117+> 3/11/96 JC Modified to call BuildSuiteFields regardless if Results Express
- # global to set to false and if TRACS global is set to true.
- # 2.11117> 2/23/96 JC Add TRACS support.
- # .11116+> 2/23/96 JC Add TRACS support.
- # 2.11116> 1/2/96 ML InitTCSLogging - add TCS ID constant for printing.
- # .11115+> 1/2/96 ML InitTCSLogging - add TCS ID constant for printing.
- # 2.11115> 11/13/95 ML InitTCSlogging() - Move initializing kTCSNoLoggingMethod and
- # kTCSResultsExpressMethod to InitGlobals()
- # .11114+> 11/13/95 ML InitTCSlogging() -
- # 2.11114> 4/14/95 KTA SuiteStart() - auto call InitGlobals() if not already
- # initialized.
- # 2.11113> 4/11/95 KTA Created a task isSystem7() which we now call instead of
- # determining this directly.
- # 2.11112> 3/23/95 ML SetUpOutput() - Temporarily set CommandExceptions off when
- # calling InitResultsExpress() so we don't throw if it fails
- # 2.11111> 3/8/95 ML InitTCSLogging() - removed gDialoghandling
- # 2.11110> 2/28/95 ML marked
- # 2.1119> 2/28/95 KTA Added Marks, TCSEnd() - Don't check for unexpected dialogs if
- # pBailFlag set.
- # 2.1118> 2/16/95 ML TCSEnd() - Set pResultCode to 0 if CheckforSystemFailure() is
- # true. CheckforSystemFailure() - returns boolean
- # .2.1117> 2/13/95 KTA SuiteStart() - Check to see if pUseXTools is true before calling
- # InstallEverytimeMacro.
- # .2.1116> 2/6/95 ML Revise ExitVU() to throw instead of exit
- # .2.1114> 1/31/95 KTA SuiteStart() - added call to InstallEverytimeMacro() if
- # gCrashHandling is TRUE.
- # .2.1113> 1/31/95 KTA Added gTCSEndThreadingHook, gSuiteEndThreadingHook.
- # .2.1112> 1/31/95 KTA Moved some of the CrashHandling code to the CrashHandling.Lib.
- # .2.1111> 1/19/95 KTA Changed the name of ExceptionHandler() to ExceptionDispatcher().
- # .2.1110> 1/19/95 KTA Added some of the CrashHandling stuff.
- # 1.2.119> 1/16/95 KTA Added parameter to SuiteStart(), BuildSuiteFields() to enable
- # the ability to not automatically use external tools when filling
- # out the suite header.
- # 1.2.118> 1/16/95 KTA Added exceptionHandling to TCS.Lib, also added OSVersion,
- # ROMbuild to the suiteHeader.
- # 1.2.117> 12/13/94 KTA Added ExitVU() and declaration of Global gExitVU as a task
- # reference.
- # 1.2.116> 12/13/94 KTA Removed Filetool references
- # 1.2.114> 12/13/94 KTA InitTCSLogging() - Added globals gBuildVers, gAppTitle,
- # gAppVersion, gMachineName, gIsSys7.
- # 1.2.113> 12/7/94 KTA Changes to support new exceptionHandling for VU 2.1.
- # 1.2.112> 11/29/94 ML Renamed ExceptionDispatcher to TCSExceptionDispatcher to avoid
- # conflict with ExceptionDispatcher task in ExceptionHandling.lib
- # 1.2.111> 9/22/94 KTA Added new task - CheckforSystemFailure().
- # 1.2.110> 9/21/94 KTA LogTCSRecord(), BuildTCSFields() - Added support for TCName.
- # <1.2.19> 9/20/94 KTA SuiteStart(), SuiteEnd(), TCSEnd() - Added global keyword before
- # kNullSuiteID.
- # <1.2.18> 9/20/94 KTA PrintTCSRecord() - Added Print •• if not pResultCode.
- # <1.2.17> 9/19/94 KTA InitTCSLogging() - Moved globals kNullSuiteID, gCurSuiteID from
- # Results Express.Lib. PrintTCSRecord() - added global keyword.
- # <1.2.16> 5/13/94 KTA ClearStack() - 0 for the top TCS and -1 for all the rest.
- # <1.2.15> 5/11/94 KTA Removed support for elapsed time field in TCS.
- # <1.2.14> 5/11/94 KTA TCSEnd() - Call ExceptionDispatcher prior to popping TCS from
- # stack, ClearStack() - popping TCSes in wrong order.
- # <1.2.13> 5/3/94 KTA ExceptionDispatcher() - Added check for -1105 error.
- # <1.2.12> 4/28/94 KTA SuiteEnd() -if gPrintSuiteInfo print all suiteFooter fields.
- # <1.2.11> 4/27/94 KTA SuiteEnd() - Changed SuiteVal to Completion
- # <1.2.10> 4/27/94 KTA Changed AppVers to AppVer
- # <1.2.9> 4/21/94 KTA Changed RecordMonitorInfo and insure AppVerify doesn't fail when
- # gAdditionalTargetinfo.
- # <1.2.8> 4/19/94 KTA Changed SuiteVers to SuiteVer.
- # <1.2.7> 4/15/94 KTA TCTrackingOrNot() - Changed way to determine if were going to
- # track the TCS.
- # <1.2.6> 4/14/94 KTA SuiteStart() - Added gSuiteStartHook, SuiteEnd() - Added
- # gSuiteEndHook, Changed gTCTracking to filter TCS calls.
- # <1.2.5> 4/13/94 KTA Changed RecordRAMFootPrint() to RecordGetAboutThisMacintosh().
- # <1.2.4> 4/13/94 KTA Changed gDBLogging to gTCTracking.
- # <1.2.3> 4/11/94 KTA InitTCSLogging() - Added a parameter - pCreateFiles.
- # <1.2.2> 4/11/94 KTA TCSEnd() - Added gLastResortHook().
- # <1.2.1> 4/8/94 ML add comments to task headers
- # <1.2.0> 4/5/94 KTA BuildSuiteFields() - Added 'MachineType'.
- # 1.1.117> 4/1/94 KTA SetUpOutput() - println "Initialized FileTool on the HOST";
- # 1.1.116> 4/1/94 KTA If(ResultsExpress) - added gPrintSuiteInfo, 'SuiteParams' -
- # label was misnamed 'SeedValue', removed 'SystemArch'.
- # 1.1.115> 3/31/94 KTA SuiteEnd()- added a carriage return after gAdditionalSuiteInfoFT
- # before writting to suite footer.
- # 1.1.114> 3/28/94 KTA Added <Tool>Operations.Libs.
- # 1.1.113> 3/24/94 KTA TCSEnd()- New DialogHandler.
- # 1.1.112> 3/23/94 KTA LogSuiteHeader() - Added 'MachineType'.
- # 1.1.111> 3/23/94 KTA Added globals gAdditionalTargetInfo, gPrintSuiteInfo.
- # <1.1.20> 3/22/94 KTA TCSStart() - Turn gDBLogging OFF if SuiteStart() was not called.
- # <1.1.19> 3/22/94 KTA ExceptionDispatcher() - Added gNetworkTimeout, gNetworkRetries.
- # <1.1.18> 3/22/94 KTA Now we handle TargetNames longer than 20 characters.
- # <1.1.17> 3/22/94 KTA FileTool method of logging TCSes does not support reading the
- # Prefs file anymore.
- # <1.1.16> 3/19/94 ML Output Additional suite info to notebook if gNotebookoutput is
- # true
- # <1.1.15> 3/17/94 ML Output SuiteHeaderInfo to the notebook if gNotebookOutput is
- # true.
- # <1.1.14> 3/17/94 ML added support for logging additional suite info at SuiteEnd time
- # for both RE and FT test case logging methods
- # <1.1.13> 3/16/94 ML generate tcs's for monitor and memory info after suiteheader is
- # generated in suitestart()
- # <1.1.12> 3/7/94 KTA Incorporated Results Express support.
- # <1.1.10> 12/16/93 KTA Changed the way we handle exception, changed gFileToolOutput to
- # gTestCaseLoggingMethod
- # <1.1.9> 12/13/93 KTA Added ClearStack() task, and changed the way we handle
- # exceptions.
- # <1.1.7> 12/3/93 KTA ApplicationVerification() if gAppTitle = 'Unknown' turn gAppVerify off.
- # <1.1.6> 12/3/93 KTA Logical and physical memory are now reported in bytes, also
- # added SystemArch.
- # <1.1.5> 12/2/93 KTA Removed isOff, IsOn, VirtualMemory, notAvail, etc
- # <1.1.4> 12/2/93 KTA Added SystemArchitecture to Suite header. Added
- # gSuiteFooterHook, moved call to ApplicationVerification() so it
- # would be called when gDBLogging is off, Added gTCSStartHook1.
- # <1.1.3> 11/24/93 NAGA change "TCS [" to "TEST CASE ["
- # <1.1.2> 11/24/93 NAGA In LogTCSRecord() change TCSDescription to TCDesc
- # 1.0.119> 9/30/93 KTA TCSEnd() - pTCSVal no longer defaults to 'NA' and all fields
- # which exist will printed in gNoteBook = 2.
- # 1.0.118> 9/30/93 KTA PrintTCSRecord() - Fixed a bug where pTCSVal wouldn't print if
- # is was an integer.
- # 1.0.117> 9/23/93 KTA Moved gPreFlight to InitGlobals() and deleted gLaunchReqs, also
- # fixed problem where ApplicationVerification() wasn't working.
- # 1.0.116> 9/23/93 KTA LogSuiteHeader() - Commented out Desc field.
- # 1.0.115> 9/22/93 KTA Call the gExceptionDispatcher task reference instead of calling the
- # task directly.
- # 1.0.114> 9/20/93 KTA ApplicationVerification() - Retry counter was decremented and it
- # should have been incremented.
- # 1.0.113> 9/14/93 KTA WriteTCSRecord() - If trouble with Filetool turn off
- # FileToolOutput. ApplicationVerification() -If gAppTitle
- # is not defined turn off Application Verification
- # 1.0.112> 9/13/93 KTA ExceptionDispatcher() - changed TimeOut values,
- # ApplicationVerification() - intl - regular expressions errors.
- # 1.0.111> 9/13/93 KTA Updated TestLevel specification.
- # 1.0.110> 9/2/93 KTA Not writing to string 'FileTool output' to prefs file anymore.
- # <1.0.19> 9/1/93 KTA Changed all calls to VU built in task Exit to call the task
- # reference gExitVu instead.
- # <1.0.18> 9/1/93 KTA Updated task headers and parameters.
- # <1.0.17> 8/25/93 KTA Added support for parity checking the TCS stack.
- # <1.0.16> 8/23/93 KTA Realigned fields in output, fixed TCSPassed.
- # <1.0.15> 8/20/93 KTA TCSStart() - If TCSAttempted is undefined call InitTCSLogging().
- # <1.0.14> 8/20/93 KTA Changed the return for ReadLine2, so had to update how the
- # returnvalue was being used.
- # <1.0.13> 8/20/93 KTA Added LogSuiteHeader(), LogTCSRecord(), InitTCSLogging(), to
- # support FileTool output of Phoenix data.
- # <1.0.12> 8/9/93 KTA Support for new Pheonix data format.
- # <1.0.11> 8/2/93 KTA CleanAbort() - Removed gExitFlag.
- # <1.0.10> 8/2/93 KTA CleanAbort() - Added gExitFlag.
- # <1.0.9> 7/30/93 KTA TCSEnd() - Changed DialogHandler() call and added gTCSEndHook1.
- # <1.0.8> 7/20/93 KTA Bug Fix: failreason was being reinitialized improperly. See
- # TCSEnd().
- # <1.0.7> 7/15/93 KTA Added TCSExpCount: See SuiteEnd()
- # <1.0.6> 7/6/93 KTA If gDBLogging is not set TCSEnd will not do anything.
- # <1.0.5> 6/8/93 NAGA unmark tasks that are not published
- # <1.0.4> 5/21/93 NAGA Adding header and porting old files to follow new standards
- #
- # ****************************************************************************
- #
-
- ########################################################################
- # External libraries
- #=======================================================================
- Libraries "Utility.lib","UserInterface.Lib", "Results Express.lib", "Globals.lib", "CrashHandling.lib", "String.Lib", "OutPut.Lib", "TargetCheck.Lib", 'ExceptionHandling.Lib', 'TRACS.Lib';
-
-
-
- #########################################################################
- # InitTCSLogging(pSetupFileToolOutput)
- #========================================================================
- # Author: KTA
- # Description: Initializes globals and <Constants> necessary for generating
- # database records known as TCS (Test Case Specification) records.
- # Parameters: pTestCaseLoggingMethod - The logging method
- # Returns: Nothing
- # Examples: InitTCSLogging(1,1);
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 3/21/94 Added global gNetworkTimeout, gNetworkRetries
- # KTA 9/19/94 Moved globals kNullSuiteID, gCurSuiteID from Results Express.Lib
- # ML 11/2/94 Renamed ExceptionDispatcher to TCSExceptionDispatcher to
- # avoid conflict with ExceptionHandling.lib
- # ML 3/8/95 removed gDialoghandling
- # KTA 4/11/95 Call isSystem7()
- # ML 11/13/95 Move initializing kTCSNoLoggingMethod and kTCSResultsExpressMethod
- # to InitGlobals() - these need to be defined before calling InitTCSLogging.
- # ML 1/2/96 add TCS id constant for printing
- #########################################################################
- TASK InitTCSLogging( pTestCaseLoggingMethod := global gTestCaseLoggingMethod )
- begin
-
- ##################################################
- ### Make sure this task is only executed once per script
- if global TCSLibInitialized
- return 1;
- else
- global TCSLibInitialized := true;
-
- ##################################################
- ### TCS ID Constants
- global kTCSetDefault := "UnknownSet";
- global kTCTypeDefault := "Compatibility";
- global kTCOwnerDefault := "SPECS&L";
- global kTCSetLaunch := "Launch";
- global kTCSetQuit := "Quit";
- global kTCSetSFSave := "SFSave";
- global kTCSetRevertDoc := "RevertDoc";
- global kTCSetOpenDoc := "OpenDoc";
- global kTCSetNewDoc := "NewDoc";
- global kTCSetScrapBook := "ScrapBook";
- global kTCSetFont := "Font";
- global kTCSetPageSetup := "PageSetup";
- global kTCSetPrinting := "Printing";
- global kTCSetUIWindowDrag := "UIWindowDrag";
- global kTCSetUIWindowClose := "UIWindowClose";
- global kTCSetUIWindowScroll := "UIWindowScroll";
- global kTCSetUIWindowSize := "UIWindowSize";
- global kTCSetUIWindowMiscOp := "UIWindowMiscOp";
- global kTCSetAboutBox := "AboutBox";
- global kTCSetAppSetup := "AppSetup";
- global kTCSetDraw := "Draw";
- global kTCSetSelectFromPalette := "SelectFromPalette";
- global kTCSetUseTool := "UseTool";
- global kTCSetMemorySize := "Memory Size";
- global kTCTypeConfig := "Configuration";
-
- ##################################################
- ### TCS Globals
- global gTCSList := {}; # TCS Stack
- global kNullSuiteID := -32767;
- global gCurSuiteID := kNullSuiteID;
-
- ##################################################
- ### TCS QuickStat counters
- global TCSAttempted := 0;
- global TCSPassed := 0;
- global TCSNotAvail := 0;
- global TCSExpCount := 0;
-
- ##################################################
- ### Ensure pTestCaseLoggingMethod is valid
- if IsUndefined( pTestCaseLoggingMethod )
- pTestCaseLoggingMethod := kTCS_TRACSFileToolMethod;
-
- ##################################################
- ### Set the global to match the parameter passed in.
- global gTestCaseLoggingMethod := pTestCaseLoggingMethod;
-
- ##################################################
- ### Misc. Globals needed for the suite header
- ##################################################
- ##################################################
- ### Set target info globals
- try
- begin
- match[system v:?global gBuildVers];
- if not(global gMachineName);
- match[target t:?global gMachineName];
- end;
- catch theError
- ExceptionDispatcher(theError);
-
- ##################################################
- ### Determine if OS has system 7 features
- if(isUndefined(global gIsSys7))
- IsSystem7();
-
- ##################################################
- ### Task references for exiting allows it to be overridden
- global gExitVU := task ExitVU;
-
- ##################################################
- ### Setup the Output method for logging data base records
- SetUpOutput();
- end;
-
-
- #########################################################################
- # SuiteStart(pScriptName, pScriptParamList, pScriptVersion)
- #========================================================================
- # Author: GS
- # Description: Start Suite Record.
- # Parameters: pScriptName - Name of the current script
- # pScriptParamList - list of VU parameters for the current execution
- # pScriptVersion - version of the current script
- # pMatrixID - Id for the matrix.
- # pUseXTools - Flag which indicates whether its ok to use external tools
- # when building the suite header, Ontarget is used to determine if
- # filesharing in ON, MemoryMonitor is used to read the ROMBuild.
- # Returns: Nothing
- # Examples: SuiteStart("MacDraw.vu", {1}, '1.1.2');
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 8/5/93 Rewrote calling PrintSuiteHeader
- # KTA 8/9/93 Added ability to output DB Records to Notebook and/or with FileTool
- # KTA 9/2/93 Not writing to string 'FileTool output' to prefs file anymore.
- # KTA 12/1/93 Not writing to any suite info to notebooks.
- # ML 3/16/94 generate tcs's for monitor and memory info
- # ML 3/17/94 Output SuiteHeaderInfo to the notebook if gNotebookOutput is true.
- # ML 3/23/94 Output Monitor and RAM info to TCSoutput if gAdditionalTargetInfo is true
- # KTA 4/1/94 Don't print suiteHeader to noteboook unless gPrintSuiteInfo
- # KTA 4/13/94 Changed gDBLogging to gTCTracking
- # KTA 4/13/94 Changed RecordRAMFootPrint() to RecordGetAboutThisMacintosh()
- # KTA 4/14/94 Added gSuiteStartHook
- # KTA 4/21/94 Changed when RecordMonitorInfo and RecordGetAboutThisMacintosh are called.
- # KTA 9/20/94 Added global keyword before kNullSuiteID
- # KTA 1/16/95 Added pUseXTools
- # KTA 2/13/95 Check to see if pUseXTools is true before calling InstallEverytimeMacro.
- # KTA 4/14/95 Call InitGlobals() if global gLogStrCount is not defined
- # MDF 06/18/96 Added gIsBothMethods to correctly handle both
- #########################################################################
- TASK SuiteStart(pScriptName := '', pScriptParamList := '', pScriptVersion := 'xxx', pMatrixID := 0, pUseXTools := 1 )
- begin
- global gAppTitleSaveOff := global gAppTitle; # Used in SuiteEnd() for lab report
- global gSuiteStarted := 1; # Indicates the suite was started
- global gTestCaseLoggingMethod, kTCSResultsExpressMethod,
- kTCS_TRACSFileToolMethod, gIsBothMethods;
-
- if(isUndefined(global gLogStrCount))
- InitGlobals();
-
- ### Logging test cases to a data base
- if (global gTCTracking)
- begin
- ### Initialize TCS.Lib for Test Case Logging
- InitTCSLogging(); # Initialize all globals and <Constants>
- if(global gCrashHandling) and (pUseXTools)
- InstallEveryTimeMacro(); # Will install macro
-
- if(global gSuiteStartHook)
- call(gSuiteStartHook);
-
- ###############################################
- ### Results Express Method?
- if((gTestCaseLoggingMethod = kTCSResultsExpressMethod) or gIsBothMethods)
- begin
- LogStr( "TCS Records will be written using Results Express.");
-
- tFields := BuildSuiteFields( pScriptName, pScriptVersion, "{pScriptParamList}" ,pUseXTools);
-
- if (gIsBothMethods)
- TRACS_DataCollection(tFields, 0);
-
- if (global gPrintSuiteInfo)
- begin
- for i := 1 to card (tFields)
- println tFields[i];
- end;
-
- x := NewSuite( pMatrixID, tFields );
- if( x[1] = 0 )
- begin
- global gCurSuiteID := x[2];
- end;
- else
- begin
- global gCurSuiteID := global kNullSuiteID;
- Println "SuiteStart: Failed to create new suite";
- Println "Error Code = ", x[1];
- Println "Error Msg = ", x[3];
- Println "Script Error = ", x[4];
- end;
- end;
- else
- begin
- LogStr( "Test Case logging is not being performed.");
-
- if (gTestCaseLoggingMethod = kTCS_TRACSFileToolMethod)
- begin
- tFields := BuildSuiteFields( pScriptName, pScriptVersion, "{pScriptParamList}" ,pUseXTools);
- TRACS_DataCollection(tFields, 0);
- end;
- end;
-
-
- ### You want to write Ram and Monitor info to the TCS output
- AVTemp := global gAppVerify;
- global gAppVerify := 0;
-
- RecordMonitorInfo();
- If(global gAdditionalTargetInfo)
- RecordGetAboutThisMacintosh(0,0,,,0);
-
- global gAppVerify := AVTemp;
-
- end;
-
- BeginTimer();
- end; # SuiteStart
-
- #########################################################################
- # SuiteEnd(pCompletionCode)
- #========================================================================
- # Author: GS
- # Description: End Suite Record.
- # Parameters: pCompletionCode - Code which indicates success of suite
- # 1 - Completed successfully
- # 0 - Completed unsuccessfully
- # Returns: Nothing
- # Examples: SuiteEnd(1);
- # Assumptions: none
- # Additional information concerning global gAdditionalSuiteInfoFT:
- # gAdditionalSuiteInfoFT has been provided to allow additonal information to be written
- # to the suite block. If there is additonal information that needs to be written to
- # the suite block, gAdditionalSuiteInfoFT needs to be defined as a formatted string.
- # The string should be defined as 1 or more Phoenix data fields.
- # Each new field should be in the form of "∂t∂t<FieldLabel>:∂t<FieldData>∂n"
- # If there are multiple fields that need to be returned, they should be
- # concatenated and returned as a single string. Note: the default setting is that
- # gAdditionalSuiteInfoFT is undefined and thus nothing will be added to the suite footer
- # unless explicitly defined.
- #========================================================================
- # History:
- # KTA 7/13/93 Added TCSExpCount as per Gil
- # KTA 8/4/93 support for new Pheonix data format
- # KTA 12/1/93 Not writing to any suite info to notebooks.
- # KTA 12/2/93 Added gSuiteFooterHook.
- # ML 3/17/94 support for logging additional suite info for both
- # RE and FT test case logging methods
- # ML 3/20/94 Removed gSuiteFooterHook and added gAdditionalSuiteInfoFT.
- # ML 3/17/94 Output additional info to notebook if gNotebookoutput is true
- # KTA 4/13/94 Changed gDBLogging to gTCTracking
- # KTA 4/14/94 Added gSuiteEndHook
- # KTA 4/14/94 Changed SuiteVal to Completion
- # KTA 4/28/94 if gPrintSuiteInfo print all suiteFooter fields
- # KTA 9/20/94 Added global keyword before kNullSuiteID
- # KTA 9/20/94 Added call to CheckForSystemFailure().
- # KTA 1/31/95 Added gSuiteEndThreadingHook
- # JC 2/19/96 Added TRACS output support.
- # MDF 06/17/96 Modified to check for single digit day if doing TRACS logging
- # method.
- # MDF 06/18/96 Added gIsBothMethods to correctly handle both test case
- # logging methods.
- # MDF 06/18/96 Added support for tracking the number of failed test cases.
- #########################################################################
- TASK SuiteEnd(pCompletionCode := 1, pCheckIfSystemFailed := 1)
- begin
- global gTestCaseLoggingMethod, kTCSResultsExpressMethod,
- kTCS_TRACSFileToolMethod, gIsBothMethods;
-
- if(global gSuiteStarted) # Suite was started.
- begin # Indicates that SuiteStart was called
-
- if(pCheckIfSystemFailed) and (pCompletionCode)
- CheckforSystemFailure();
-
- if(pCompletionCode = 1)
- Endtimer();
-
- if (global gTCTracking)
- begin
- AdditionalSuiteInfo := '';
-
- global TCSAttempted, TCSPassed,gAppTitleSaveOff,TCSNotAvail, TCSExpCount;
-
- suiteEndTime := GetCurrentTime(1,0);
- try
- match[time d:?day m:?month y:?year];
- catch theError
- ExceptionDispatcher(theError);
- suiteEndDate := "{month}/{day}/{year}";
-
- ###############################################
- ### Results Express Method?
- if((gTestCaseLoggingMethod = kTCSResultsExpressMethod) or gIsBothMethods)
- begin
- if( not EqualREIDs( global gCurSuiteID, global kNullSuiteID ) )
- begin
-
- tFields := {
- { 'EndDate ', suiteEndDate },
- { 'EndTime ', suiteEndTime },
- { 'Completion', pCompletionCode }
- };
-
- if (global gAddSuiteInfoFieldsRE)
- tFields := gAddSuiteInfoFieldsRE + tFields;
-
- if (global gPrintSuiteInfo)
- begin
- for i := 1 to card (tFields)
- println tFields[i];
- end;
-
- x := AddSuiteFields( global gCurSuiteID, tFields );
- if( x[1] <> 0 )
- begin
- Println "SuiteEnd : AddSuiteFields failed";
- end;
- end;
- else
- begin
- println "SuiteEnd called when no Current Suite ID was defined";
- end;
- end;
- else
- LogStr( "Test Case logging is not being performed.");
-
- # This is for MatrixCheck - QuickStats
- tab := "∂t";
- println "¬ ",gAppTitleSaveOff, tab, TCSExpCount, tab, TCSPassed, tab, TCSAttempted, tab, TCSNotAvail, tab, pCompletionCode, tab, tab, suiteEndDate, tab, SuiteEndTime;
-
- if ((gTestCaseLoggingMethod = kTCS_TRACSFileToolMethod) or gIsBothMethods)
- begin
- monthwithleadingzero := "{month}"; #TRACS needs leading zeros on 1 digit months
- numChar := Card(monthwithleadingzero);
-
- dayWithLeadingZero := "{day}";
- numDayChar := card(dayWithLeadingZero);
-
- if (numChar = 1)
- monthwithleadingzero := "0" + monthwithleadingzero;
-
- if(numDayChar = 1)
- dayWithLeadingZero := "0" + dayWithLeadingZero;
-
- suiteEndDate := "{monthwithleadingzero}/{dayWithLeadingZero}/{year}";
-
- TRACS_Data := {};
-
- TRACS_Data := TRACS_Data + { {"Application title", gAppTitleSaveOff } };
-
- TRACS_Data := TRACS_Data + { {"TCS Exp Count", TCSExpCount } };
-
- TRACS_Data := TRACS_Data + { {"TCS Passed", TCSPassed } };
-
- TRACS_Data := TRACS_Data + { {"TCS Failed", (TCSAttempted - TCSPassed - TCSNotAvail)} };
-
- TRACS_Data := TRACS_Data + { {"TCS Attempted", TCSAttempted } };
-
- TRACS_Data := TRACS_Data + { {"TCS Not Avail", TCSNotAvail } };
-
- TRACS_Data := TRACS_Data + { {"Suite Completion Code", pCompletionCode } };
-
- TRACS_Data := TRACS_Data + { {"Suite End Date", suiteEndDate } };
-
- TRACS_Data := TRACS_Data + { {"Suite End Time", SuiteEndTime } };
-
- TRACS_DataCollection(TRACS_Data, 1);
- end;
-
- if(global gSuiteEndHook)
- call(gSuiteEndHook);
- end;
- end; # The suite was never started
- if(global gSuiteEndThreadingHook)
- call(gSuiteEndThreadingHook);
- end;
-
- #########################################################################
- # TCSStart(pTCSId, pTextDesc, pAppName)
- #========================================================================
- # Author: GS
- # Description: Start TCS Record.
- # Parameters: pTCSId - The TCS Id that results are being recorded for (list)
- # 1st element - Test Case number (integer)
- # 2nd element - Test Case Set (string)
- # 3rd element - Test Case Type (string)
- # 4th element - Test Case Owner (string)
- # pTextDesc - string that describes the Test Case
- # pAppName - defaults to gAppTitle, otherwise the name of the
- # application the Test Case applies to
- # Returns: Nothing
- # Examples: TCSStart();
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 8/20/93 If TCSAttempted is undefined call InitTCSLogging()
- # KTA 12/01/93 Added gTCSStartHook1, and moved ApplicationVerification
- # so it will be called even if gDBLogging is off
- # KTA 3/22/94 Turn gDBLogging OFF if SuiteStart() was no called.
- # KTA 4/13/94 Changed gDBLogging to gTCTracking
- # KTA 5/11/94 Removed support for elapsed time field in TCS
- # KTA 1/16/95 Added a try/catch block for the match
- # KTA 1/18/95 Added pTargetAlive so you can indicate whether its OK to
- # match the target or not/ also removed gAppIdentifier.
- #########################################################################
- TASK TCSStart(pTCSId, pTextDesc, pAppName := global gAppTitle, pTargetAlive := 1)
- begin
- if(global gTCSStartHook1)
- Call(gTCSStartHook1);
-
- if (TCTrackingOrNot(pTCSId))
- begin
- if not(global gSuiteStarted)
- begin
- LogStr("Note: SuiteStart() was not called prior to making a TCS call - turning TCS logging OFF");
- global gTCTracking := 0;
- Return(0);
- end;
-
- global TCSAttempted := TCSAttempted + 1;
- pTCSId := FillTCSId( pTCSId );
-
- if not (pAppName) # If AppName is not defined, define it.
- begin
- try
- begin
- if(pTargetAlive)
- Match[application t:?pAppName];
- else
- pAppName := 'Unknown';
- end;
- catch theError
- ExceptionDispatcher(theError);
- end;
-
- thisTCS := {pTCSId, pTextDesc, pAppName};
- TCSPush(thisTCS);
- end;
-
- if (global gAppVerify) and (pTargetAlive) # Verify that the correct Application is running
- ApplicationVerification(1);
- end;
-
- #########################################################################
- # TCSEnd(pTCSId,pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr)
- #========================================================================
- # Author: GS
- # Description: This task is called when the functionality of the pending TCS
- # is complete. It will pop the top TCS record from the TCS stack,
- # check to insure the TCS numbers match. If the result code (<pResultCode>)
- # is 0 a check will be done to insure no unexpected dialogs are present.
- # A call to ExceptionDispatcher() is made to insure that no VU errors were
- # encountered. Then the appropriate output task is called to output the
- # data.
- # Parameters: pTCSId - The TCS Id that results are being recorded for (list)
- # 1st element - Test Case number (integer)
- # 2nd element - Test Case Set (string)
- # 3rd element - Test Case Type (string)
- # 4th element - Test Case Owner (string)
- # pResultCode - The result of the TCS on top of Stack (Lifo)
- # pErrStr - Reason for failure if known.
- # pTCSVal - Any value a TCS needs to return for additional info.
- # pTCSStr - Any string a TCS needs to return for additional info.
- # pCommentStr - A string the TCS can return results in.
- # pBailFlag - incase of critical error we may need to dump the stack
- # - 'NoRecursion' this will avoid recursion
- # - any integer will bail the suite with the value of the integer
- # Returns: Nothing
- # Examples: TCSEnd();
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 7/6/93 If not gDBLogging TCSEnd will not do anything
- # KTA 7/20/93 Failreason was being reinitialized thus destroying any parameter data.
- # KTA 7/28/93 Added gTCSEndHook1 and reworked dialogHandler
- # KTA 8/05/93 Support for new Pheonix data format
- # KTA 8/09/93 Added pDumpStack parameter
- # KTA 8/24/93 TCS stack parity check
- # KTA 12/01/93 moved gTCSEndHook1 so it will be called even if gDBLogging is off.
- # KTA 12/1/93 Not writing total TestCase info to notebooks.
- # KTA 12/13/93 Changed parameter pDumpStack to pBailFlag
- # KTA 3/24/94 Changed DialogHandler() thus had to change call.
- # KTA 3/24/94 Added gLastResortHook()
- # KTA 4/13/94 Changed gDBLogging to gTCTracking
- # KTA 5/11/94 Call ExceptionDispatcher prior to popping TCS from stack.
- # KTA 5/11/94 ExceptionDispatcher doesn't supported elapsed time anymore.
- # KTA 5/11/94 Removed support for elapsed time field in TCS
- # KTA 9/20/94 Added global keyword before kNullSuiteID
- # KTA 1/17/95 Added CheckforSystemFailure()
- # KTA 1/31/95 Added gTCSEndThreadingHook
- # ML 2/16/95 Set pResultCode to 0 if CheckforSystemFailure() is true
- # KTA 2/28/95 Don't check for unexpected dialogs if pBailFlag set.
- # MDF 06/18/96 Added gIsBothMethods to correctly handle both test case
- # logging methods.
- #########################################################################
- TASK TCSEnd(pTCSId := {}, pResultCode := '', pErrStr := '', pTCSVal := '', pTCSStr := '', pCommentStr := '', pBailFlag := '')
- begin
- global gTestCaseLoggingMethod, kTCSResultsExpressMethod, gIsBothMethods;
-
- if(global gTCSEndHook1)
- Call (gTCSEndHook1, TopOfTCSStack());
-
- if (TCTrackingOrNot(pTCSId))
- begin
- if (pBailFlag = '') # Check if the system died
- if (CheckforSystemFailure())
- pResultCode:= 0;
-
- thisTCS := TCSPop(); # Pop the current TCS
- #### TCS Parity check - are we working with the right TCS???
- StackTCSId := thisTCS[1];
- if (StackTCSId[1] <> pTCSId[1]) or (StackTCSId[2] <> pTCSId[2])
- begin
- println " TCS mismatched : TOS - ", StackTCSId, ", Passed in - ", pTCSId;
- println " Exiting Script - the TCS stack is unbalanced";
- call (global gExitVU);
- end;
-
- if (typeOf(pResultCode) = 'string') # if embedded task returns string, i.e. selectmenuitem
- pResultCode:=1; # set pResultCode to success
-
- #### Handle unexpected dialogs
- if (pResultCode = 0) and (pBailFlag = '') # dialogCheck for pResultCode < 0
- begin
- theDialoglist := DialogHandler();
- theResult := theDialoglist[1];
- StaticTextString := theDialoglist[2];
-
- if (theResult <> -1) # No dialogs were present
- begin
- if(theResult >= 1) # Unexpected dialogs that we were able to dismiss
- pCommentStr := pCommentStr + "Dismissed unexpected dialogs : " + StaticTextString;
- else if((theResult = 0) and (global gLastResortHook))
- begin
- pErrStr := pErrStr + "NOTE: Calling gLastResortHook() because of failure in infinite dialog loop - {StaticTextString}";
- call(gLastResortHook);
- end;
- else if(theResult = 0) # Unexpected dialogs that we weren't able to dismiss
- begin
- pErrStr := pErrStr + "Failed in infinite dialog loop - {StaticTextString}";
- pBailFlag := 0; # Abort suite fail with a 0
- end;
- end;
- end;
- else if (pResultCode < 0) # QuickStats
- global TCSNotAvail := TCSNotAvail + 1;
- else if (pResultCode > 0)
- global TCSPassed := TCSPassed + 1;
-
- ### Output database records to the NoteBook
- PrintTCSRecord(thisTCS, pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr);
-
- ### Output database records using Results Express ?
- if((gTestCaseLoggingMethod = kTCSResultsExpressMethod) or gIsBothMethods)
- begin
- if( not EqualREIDs( global gCurSuiteID, global kNullSuiteID ) )
- begin
- tFields := BuildTCSFields( thisTCS, pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr);
- x := NewTestCase( global gCurSuiteID, tFields );
- if( x[1] <> 0 )
- Println "EndSuite : NewTestCase failed";
- end;
- else
- println "TCSEnd called when no Current Suite ID was defined";
- end;
-
- if not(pBailFlag = '') and not(pBailFlag = 'NoRecursion') # Bail the suite
- CleanAbort(pErrStr,pBailFlag);
- end;
- if(global gTCSEndThreadingHook)
- call (gTCSEndThreadingHook);
- end; # TCSEnd
-
-
-
- #########################################################################
- # SetUpOutput()
- #========================================================================
- # Author: KTA
- # Description: if global gTestCaseLoggingMethod = global kTCSResultsExpressMethod
- # ResultsExpress will be initialized.
- # Parameters: none
- # Returns: Nothing
- # Examples: SetUpOutput(1);
- # Assumptions:
- #========================================================================
- # History:
- # KTA 12/1/93 Not writing total TestCase info to notebooks.
- # KTA 3/22/94 Not reading Prefs file anymore when using kTCSFileToolMethod.
- # KTA 3/22/94 Handle TargetNames > 20 characters
- # KTA 12/7/94 Removed FileTool logging method
- # ML 3/23/95 Temporarily set CommandExceptions off when calling
- # InitResultsExpress() so we don't throw if it fails
- # MDF 06/18/96 Added gIsBothMethods to correctly handle both test case
- # logging methods.
- #########################################################################
- task SetUpOutput()
- begin
- global gTestCaseLoggingMethod, kTCSResultsExpressMethod, gIsBothMethods;
-
- ##################################################
- ### If using kTCSResultsExpressMethod for logging Test Cases
- ### then initialize Results Express as an external tool
- if((gTestCaseLoggingMethod = kTCSResultsExpressMethod) or gIsBothMethods)
- begin
- tempCommandExceptions := CommandExceptions(0);
- x := InitResultsExpress();
- CommandExceptions(tempCommandExceptions);
- if( x[1] <> 0 )
- begin
- Println "Failed to initialize the 'Results Express' external tool";
- Println "Error Code = ", x[1];
- Println "Error Msg = ", x[3];
- Println "Script Error = ", x[4];
- Println "Test Case logging is now turned OFF";
- gTestCaseLoggingMethod := 0; # no logging
- end;
- end;
- end; # SetUpOutput
-
- #########################################################################
- # FillTCSId( pTCSId )
- #========================================================================
- # Author: naga
- # Description: Start TCS Record.
- # Parameters: pTCSId
- # Returns: new complete TCSId ( a list of 4 elements)
- # Examples: newId := FillTCSId( oldId );
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 12/7/94 Direct list assignment
- #########################################################################
- TASK FillTCSId( pTCSId )
- begin
- if (TypeOf(pTCSId) = 'list')
- begin
- if (IsUndefined(pTCSId[1]))
- pTCSId[1] := 0;
- else if (TypeOf(pTCSId[1]) <> 'integer')
- pTCSId[1] := 0;
-
- if (IsUndefined(pTCSId[2]))
- pTCSId[2] := global kTCSetDefault;
- else if (TypeOf(pTCSId[2]) <> 'string')
- pTCSId[2] := global kTCSetDefault;
-
- if (IsUndefined(pTCSId[3]))
- pTCSId[3] := global kTCTypeDefault;
- else if (TypeOf(pTCSId[3]) <> 'string')
- pTCSId[3] := global kTCTypeDefault;
-
- if (IsUndefined(pTCSId[4]))
- pTCSId[4] := global kTCOwnerDefault;
- else if (TypeOf(pTCSId[4]) <> 'string')
- pTCSId[4] := global kTCOwnerDefault;
-
- return pTCSId;
- end;
- else # Not a list
- begin
- println "!!!! Improper TCS Id -- ", pTCSId, " !!!!" ;
- if (TypeOf(pTCSId) = 'integer') #if using old style numeric Id
- return { pTCSId, global kTCSetDefault, global kTCTypeDefault, global kTCOwnerDefault };
- else
- return { 0, global kTCSetDefault, global kTCTypeDefault, global kTCOwnerDefault };
- end;
- end;
-
- #########################################################################
- # PrintTCSRecord(pTCSRecord, pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr)
- #========================================================================
- # Author: KTA
- # Description: Prints TCS record information to the notebook.
- # Parameters: pTCSRecord - The current TCS Record from top of stack
- # pResultCode - Result of the TCS
- # pCommentStr - String provided for returning results
- # pTCSVal - field for TCS specific values
- # pTCSStr - field for TCS specific strings
- # pErrStr - String for explaining failure
- # Returns: Nothing
- # Examples: PrintTCSRecord();
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 8/09/93 Added check to see if field exist before printing it.
- # KTA 9/30/93 Fixed a bug where pTCSVal wouldn't print if is was an integer
- # KTA 9/30/93 Print all fields for gNoteBookOutput = 2 if they exist
- # KTA 12/01/93 Can no longer print complete Test Case output to notebooks
- # KTA 9/19/94 Added global keyword
- # KTA 9/20/94 Added Print •• if not pResultCode
- # KTA 12/7/94 Changed order of parameters and print statements
- # KTA 12/12/94 Removed reference to gNotebookOutput
- #########################################################################
- task PrintTCSRecord(pTCSRecord, pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr)
- begin
- if(pResultCode )
- theChar := '•';
- else
- theChar := '••';
-
- println " {theChar}TCS - ", pTCSRecord[1], ", ",pTCSRecord[2], ", ", pResultCode, ", ", pErrStr, ", ", pTCSVal, ", ", pTCSStr, ", ", pCommentStr;
- end;
-
- #########################################################################
- # BuildSuiteFields( pScriptName, pScriptVersion, pScriptParameterList, pUseXTools)
- #========================================================================
- # Author: RV
- # Description: Outputs suite header information utilizing Results Express
- # Parameters: pScriptName - Name of the current script
- # pScriptVersion - Version of the current script
- # pScriptParameterList - Parameters to the current script
- # pUseXTools -Flag which indicates whether its ok to use external tools
- # when building the suite header, Ontarget is used to determine if
- # filesharing in ON, MemoryMonitor is used to read the ROMBuild.
- # Returns: Nothing
- # Examples: LogSuiteHeader("MacDraw", '1.0',{1});
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 9/23/93 Commented out Desc field as we can't get any useful info for this field yet.
- # KTA 4/1/94 'SuiteParams' - label was misnamed 'SeedValue'.
- # KTA 4/5/94 Added 'MachineType'
- # KTA 4/19/94 Changed SuiteVers to SuiteVer
- # KTA 4/27/94 Changed AppVers to AppVer
- # KTA 1/16/95 Added OSVersion and ROMBuild support
- # KTA 1/16/95 Added pUseXTools
- # JC 2/19/96 Added TRACS output support.
- #########################################################################
- task BuildSuiteFields( pScriptName := 'na', pScriptVersion := 'na', pScriptParameterList := "", pUseXTools := 1)
- begin
- SuiteHeaderString := "∂n∂n";
-
- tSuiteFields := {};
-
- ### Get a bunch of info
- theMachineState := MachineState(,pUseXTools);
-
- ### TargetName
- tSuiteFields := tSuiteFields + { { "TargetName", assoc('TargetName', theMachineState) } };
-
- ### MachineType
- tSuiteFields := tSuiteFields + { { "MachineType", assoc('MachineType', theMachineState) } };
-
- ### AppName
- if not( global gAppTitle )
- gAppTitle := 'Unknown';
- tSuiteFields := tSuiteFields + { { "AppName", gAppTitle } };
-
- ### AppVersion
- if ( global gAppVersion )
- tSuiteFields := tSuiteFields + { { "AppVer", gAppVersion } };
-
- ### ScriptName
- tSuiteFields := tSuiteFields + { { "SuiteName", pScriptName } };
-
- ### ScriptVersion
- tSuiteFields := tSuiteFields + { { "SuiteVer", pScriptVersion } };
-
- ### SystemVersion
- tSuiteFields := tSuiteFields + { { "OSVersion", assoc('OSVersion', theMachineState) } };
-
- ### ROM Build
- tSuiteFields := tSuiteFields + { { "ROMBuild", assoc('ROMBuild', theMachineState) } };
-
- ### SuiteStartDate
- Try
- begin
- match[time d:?day m:?month y:?year];
- tSuiteFields := tSuiteFields + { { "StartDate", "{month}/{day}/{year}" } };
- end;
- catch theError
- ExceptionDispatcher(theError);
-
- ### SuiteStartTime
- suiteStartTime := GetCurrentTime(1,0);
- tSuiteFields := tSuiteFields + { { "StartTime", SuiteStartTime } };
-
- ### Description
- # tSuiteFields := tSuiteFields + { { "Desc", "Just say 'Ship It'" } };
-
- ### SeedValue
- tSuiteFields := tSuiteFields + { { "SeedValue", global gSeedValue } };
-
- ### SuiteParams
- drawMethod := "gDrawLevel := {global gDrawLevel}; ";
- WindowMethod := "gWindowLevel := {global gWindowLevel}; ";
- FontMethod := "gFontLevel := {global gFontLevel};";
- globList := drawMethod + WindowMethod + FontMethod;
- tSuiteFields := tSuiteFields + { { "SuiteParams", pScriptParameterList + " " + globList } };
-
- ### AddrMode
- tSuiteFields := tSuiteFields + { { "AdMode32", assoc('AddrMode', theMachineState) } };
-
- ### LogicalMem
- tSuiteFields := tSuiteFields + { { "LogicalMem", assoc('LogicalMem', theMachineState) } };
-
- ### PhysicalMem
- tSuiteFields := tSuiteFields + { { "PhysicalMem", assoc('PhysicalMem', theMachineState) } };
-
- ### VM
- tSuiteFields := tSuiteFields + { { "VM", assoc('VM', theMachineState) } };
-
- ### FileSharing
- tSuiteFields := tSuiteFields + { { "FileShare", assoc('FileShare', theMachineState) } };
-
- ### Cache
- tSuiteFields := tSuiteFields + { { "Cache", assoc('cache', theMachineState) } };
-
- return tSuiteFields;
- end;
-
- #########################################################################
- # BuildTCSFields(pTCSRecord, pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr )
- #========================================================================
- # Author: RV
- # Description: Builds a list of fields for the TCS record for use with Results Express.
- # Parameters: pTCSRecord - The current TCS Record from top of stack
- # pResultCode - Result of the TCS
- # pCommentStr - String provided for returning results
- # pTCSVal - field for TCS specific values
- # pTCSStr - field for TCS specific strings
- # pErrStr - String for explaining failure
- # Returns: list of fields (e.g. list of Label/Value pairs)
- # Examples: BuildTCSFields(thisTCS,1);
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 9/14/93 If trouble with Filetool turn off fileToolOutput
- # KTA 5/11/94 Removed support for elapsed time field in TCS
- # KTA 9/21/94 Added support for TCName
- # KTA 12/7/94 if not( pTCSVal = '')
- #########################################################################
- task BuildTCSFields(pTCSRecord, pResultCode, pErrStr, pTCSVal, pTCSStr, pCommentStr )
- begin
- tFields := {};
-
- ### Test Case Number
- ### Test Case Set
- ### Test Case Type
- ### Test Case Owner
- tFields := tFields + { { 'TCNo ', pTCSRecord[1][1] },
- { 'TCSet ', pTCSRecord[1][2] },
- { 'TCType ', pTCSRecord[1][3] },
- { 'TCOwner ', pTCSRecord[1][4] }
- };
-
- ### Test Case Name
- theTCName := pTCSRecord[1][5];
- if(theTCName)
- tFields := tFields + {{ 'TCName', theTCName }};
-
- ### Test Case Description
- ### Test Case Result
- tFields := tFields + { { 'TCDesc ', pTCSRecord[2] },
- { 'Result ', pResultCode }
- };
- ### Result String
- if( pCommentStr )
- tFields := tFields + {{ 'Comments', pCommentStr }};
-
- ### Result Value
- if not( pTCSVal = '')
- tFields := tFields + {{ 'NumericVal', pTCSVal }};
-
- ### Text Value
- if( pTCSStr )
- tFields := tFields + {{ 'TextVal ', pTCSStr }};
-
- ### Error Description
- if( pErrStr )
- tFields := tFields + {{ 'ErrDesc ', pErrStr }};
-
- return tFields;
- end;
-
-
- #########################################################################
- # TopOfTCSStack()
- #========================================================================
- # Author: KTA
- # Description: Returns the top element of TCS stack.
- # Parameters: nothing
- #
- # Returns: thisTCS - TCS from the top of the stack
- # Examples: myTCS := TopOfTCSStack();
- # Assumptions: None
- #========================================================================
- # History:
- #
- #########################################################################
- task TopOfTCSStack()
- begin
- return(global gTCSList[card(gTCSList)]);
- end;
-
- #########################################################################
- # TCSPop()
- #========================================================================
- # Author: KTA
- # Description: Pops the top element from the stack and returns it.
- # Parameters: nothing
- #
- # Returns: thisTCS - TCS record from the top of the stack
- # Examples: myTCS := TCSPop();
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 12/7/94 Removed gDebugFlag
- #########################################################################
- task TCSPop()
- begin
- global gTCSList;
- thisTCSPos := card(gTCSList);
- thisTCS := gTCSList[thisTCSPos];
- gTCSList := remove(thisTCSPos, gTCSList); #decrement the stack
- return(thisTCS);
- end;
-
- #########################################################################
- # TCSPush(pThisTCS)
- #========================================================================
- # Author: KTA
- # Description: Push <pThisTCS> onto the stack
- # Parameters: pThisTCS - TCS record to push onto the stack
- #
- # Returns: Nothing
- # Examples: TCSPush(myTCS);
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 12/7/94 Direct list assignment
- #########################################################################
- task TCSPush(pThisTCS)
- begin
- global gTCSList[card(gTCSList) + 1] := pThisTCS;
- end;
-
- #########################################################################
- # ClearStack(pFailReason)
- #========================================================================
- # Author: KTA
- # Description: Pops all of the TCSes from the TCS stack appropriately failing
- # them with an error code of -1
- # Parameters: pFailReason - Reason for failing TCS that is at the top of the stack.
- # Returns: Nothing
- # Examples: ClearStack('I wanted to');
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 12/13/93 Created
- # KTA 5/11/94 We were clearing the stack in the wrong order
- # KTA 5/12/94 0 for the top TCS and -1 for all the rest.
- #########################################################################
- TASK ClearStack(pAbortReason := '')
- begin
- numTCSes := Card(global gTCSList);
- whichTCS := numTCSes;
- for i := 1 to numTCSes
- begin
- thisTCS := gTCSList[whichTCS];
- TCSNum := thisTCS[1];
- if (i = 1) # The current fail reason should only belong to the top of the stack
- TCSEnd(TCSNum, 0, pAbortReason,,,,'NoRecursion');
- else
- TCSEnd(TCSNum, -2, "The previous TCS created a critical failure",,,,'NoRecursion');
-
- whichTCS := whichTCS - 1;
- end;
- end;
-
-
- #########################################################################
- # CleanAbort(pFailReason, pSuiteComplete := 0)
- #========================================================================
- # Author: GS
- # Description: Dumps the TCS stack appropriately failing the TCS's that
- # couldn't be completed. Then releases the target, and exits
- # the script
- # Parameters: pFailReason - Reason for failing TCS.
- # pSuiteComplete - Completion Code for Suite.
- # Returns: Nothing
- # Examples: CleanAbort();
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 9/1/93 Updated so only the TCS record at the top of the stack will
- # fail with a 0, all others fail with -1 (expected fail)
- # KTA 12/13/93 Moved functionality of clearing the stack to it's own task - ClearStack().
- # KTA 5/11/94 CleanAbort doesn't supported elapsed time anymore.
- # KTA 2/2/95 Removed Releasing the target
- #########################################################################
- task CleanAbort(pAbortReason := '', pSuiteComplete := 0)
- begin
- println "Aborting Script";
-
- ClearStack(pAbortReason);
-
- SuiteEnd(pSuiteComplete,0);
-
- call (global gExitVU);
- end;
-
- #########################################################################
- # ApplicationVerification(pAppVerify)
- #========================================================================
- # Author: KTA
- # Description: Verify that the current Application is the same as the global
- # gAppTitle. If not successfull, Abort of script will occur thru
- # ExceptionDispatcher().
- # Parameters: pAppVerify - 1 := will make the check
- # 0 := will not make the check
- # Returns: nothing
- # Examples: ApplicationVerification(1);
- # Assumptions: None
- #========================================================================
- # History:
- # KTA 9/14/93 If gAppTitle is not defined turn off Application Verification
- # KTA 9/20/93 Retry counter was decremented and it should have been incremented
- # KTA 9/22/93 theAppTitle was undefined
- # KTA 12/06/93 if gApptitle = 'Unknown' turn off gAppVerify
- # KTA 3/24/94 Define gAppTitle even if we've turned off gAppVerify.
- # KTA 5/11/94 ExceptionDispatcher doesn't supported elapsed time anymore.
- #########################################################################
- task ApplicationVerification(pAppVerify := 0)
- begin
- if (pAppVerify) and (Global gAppVerify)
- begin
- if not(global gAppTitle) or (gApptitle = 'Unknown')
- begin
- LogStr("The global 'gAppTitle' was not defined turning OFF the Application Verfication scheme");
- global gAppVerify := 0;
- gAppTitle := _Match([application]).t;
- end;
- else
- begin
- retry := 0;
- while not( _match([application t:gAppTitle])) # assume target crashed if app name not match
- begin
- if (retry < 2)
- begin
- Try
- begin
- match[menuitem t:gAppTitle m:[menu t:?Menutitle]];
- Select[MenuItem t:gAppTitle m:[menu t:Menutitle]];
- wait(3);
- end;
- catch theError
- ExceptionDispatcher(theError);
- retry := retry + 1;
- end;
- else
- begin
- theAppTitle := _Match([application]).t;
- KeyEq('q'); # Quit
- Println "*** Failed Application Verification - aborting script and typing key Equivalent 'Q'";
- Println;
- CleanAbort("Failed app verification scheme - *** Current app: '{theAppTitle}' *** Expected app: '{gAppTitle}'");
- end;
- end;
- end;
- end;
- end; # ApplicationVerification()
-
-
- #########################################################################
- # TCTrackingOrNot(pTCID)
- #========================================================================
- # Author: KTA
- # Description: Determines if individual TCSes should be tracked or not by
- # comparing the value of <pTCID> with the global gTCTracking.
- # If gTCTracking = 0 - no Test Cases will be tracked.
- # If gTCTracking = 1 - all Test Cases will be tracked.
- # If gTCTracking = <list> - only the Test Cases that have a pTCID
- # which is in the list will be tracked.
- #
- # Parameters: pTCID - The pTCID from a call to TCSStart and/or TCSEnd
- # Returns: 0 - don't perform Test Case tracking
- # 1 - perform Test Case tracking
- # Examples: TCTrackingOrNot("Performance");
- # Assumptions:
- #========================================================================
- # History:
- # KTA 4/14/94 Created
- # KTA 4/15/94 Changed way to determine if were going to track the TCS to use
- # the TCID instead or requiring an additional symbol.
- #########################################################################
- task TCTrackingOrNot(pTCID)
- begin
- returnVal := 0;
- global gTCTracking;
- if (gTCTracking)
- begin
- if(gTCTracking = 1)
- returnVal := 1;
- else if (Typeof(gTCTracking) = 'list')
- begin
- if (isMember(pTCID,gTCTracking))
- returnVal := 1;
- else
- begin
- numTimes := Card(gTCTracking);
- for iterations := 1 to numTimes # For each TC specifier in gTCTracking
- begin
- TrackedTC := gTCTracking[iterations];
- theNumTimes := Card(TrackedTC);
- for i := 1 to theNumTimes # For each element of the TC
- begin
- if (TrackedTC[i])
- begin
- if(pTCID[i] = TrackedTC[i]) # Insure each item that defines match
- returnVal := 1;
- else
- begin
- returnVal := 0;
- i := theNumTimes;
- end;
- end;
- end;
- if (returnVal)
- iterations := numTimes; # If there was a match we're done
- end;
- end;
- end;
- else if(pTCID = gTCTracking)
- returnVal := 1;
- end;
- return(returnVal);
- end;
-
-
- #########################################################################
- # CheckforSystemFailure()
- #========================================================================
- # Author: KTA
- # Description: Check for a system failure and calls Logs a testcase there was one.
- # Parameters: none
- # Returns: Nothing - But will call TCSEnd with the suitebailflag set, so
- # the suite will be ended if there was a system crash.
- # Examples: CheckforSystemFailure();
- # Assumptions: none
- # Called by suiteEnd to insure that if a crash occurred after
- # the last TCS that the data in Phoenix will represent what happened.
- #========================================================================
- # History:
- # KTA 9/22/94 Created
- # KTA 12/7/94 added try block
- # ML 2/16/95 added returnval
- #########################################################################
- task CheckforSystemFailure()
- begin
- returnval := not (_match([mouse]));
- theError := scriptError();
- if(theError)
- begin
- LogStr('The target crashed and CommandExceptions is not - ON');
- DefaultCrashHandler(theError, {1});
- end;
- return (returnval);
- end;
-
- #########################################################################
- # ExitVU()
- #========================================================================
- # Author: KTA
- # Description: This task makes the built in VU task Exit. The purpose
- # of defining this as a task is so we can use a task
- # reference to this task- gExitVu. This way we can default
- # our Exception Handling task to call the task reference gExitVU
- # and thus exit. If others do not want to exit they can redefine
- # the task reference to what ever task they prefer.
- # Parameters: None
- # Returns: Nothing
- # Examples: ExitVU(); or to use the task reference - Call(global gExitVU);
- # Assumptions: Note: gExitVU is defined in Globals.lib. If you want to
- # override this task reference please do not modify Globals.Lib,
- # override the it by redefining it in Custom.Lib.
- #########################################################################
- #========================================================================
- # History:
- # ML 2/3/94 Throw instead of exit
- #########################################################################
- TASK ExitVU()
- begin
- throw "Thrown from ExitVU";
- end;